<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<script type="text/javascript">
$(function(){
	 var timetosaygoodbye = getRelativeDate("${vo.avo.auctionTime}");      
     $('#countdown').timeTo({
         timeTo: timetosaygoodbye,
         displayDays: 1,
         theme: "black",
         displayCaptions: true,
         fontSize: 20,
         captionSize: 1
     },function(){
         alert('Countdown finished');
     }); 

     function getRelativeDate(days){         
         var date = new Date((new Date("${vo.avo.timePosted}")).getTime() + 60000 /* milisec */ * 60 /* minutes */ * 24 /* hours */ * days /* days */);
          return date;
     };	
	$("#adminDel").click(function(){
		if(confirm("진짜 삭제하시겠습니까?")){
			$(location).attr('href',"${initParam.root}admin/adminDeleteAuction.do?boardNo=${vo.avo.boardNo}&deleteConfirmNo=${param.deleteConfirmNo}&receiveMemberId=${vo.mvo.memberId}&receiveMemberNo=${vo.mvo.memberNo}&sendMemberId=${sessionScope.advo.adminId}");
		}else{
			$(location).attr('href',"${initParam.root}admin/adminNotDeleteAuction.do?boardNo=${vo.avo.boardNo}&deleteConfirmNo=${param.deleteConfirmNo}&receiveMemberId=${vo.mvo.memberId}&receiveMemberNo=${vo.mvo.memberNo}&sendMemberId=${sessionScope.advo.adminId}");
		}
	});
	$("#adminUpdat").click(function(){
		if(confirm("관리자 수정 페이지로 이동하시겠습니까?")){
			$(location).attr('href',"${initParam.root}admin/adminAuctionUpdateForm.do?boardNo=${vo.avo.boardNo}");
		}else{
			return false;
		}
	});
});
</script>

<table border="1" cellpadding="5">

	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td colspan="1" align="center">카테고리</td>
		<td colspan="4" align="center">${vo.bcvo.bigClassName} >
			${vo.scvo.smallClassName}</td>
	</tr>
	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td>제목</td>
		<td colspan="4" align="center">${vo.avo.boardTitle}</td>
	</tr>
	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td>작성자</td>
		<td id="sendMessage">${vo.mvo.memberId}</td>
		<td>신용등급</td>
		<td colspan="2">${vo.mvo.grade}</td>
	</tr>
	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td colspan="2" rowspan="3"><img width="300" height="200"
			src="${initParam.root}upload/${vo.avo.attatchedFile}"></td>
		<td>수량</td>
		<td>${vo.avo.quantity}</td>
		<!-- 만료시간 -->
		<td rowspan="3">
		<c:choose>
			<c:when test="${vo.avo.activeCheck==1}">
				<font color="red"><b>판매종료</b></font><!-- 비활성화 -->
			</c:when>
			<c:otherwise>
			만료시간 :
			<div id="countdown"></div>
			</c:otherwise>
		</c:choose>
		</td>
	</tr>
	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td>경매시작</td>
		<td>${vo.avo.auctionPrice}</td>
	</tr>
	<%-------------------------------------------------------------------------- --%>
	<tr>
		<td>즉시구매</td>
		<td>${vo.avo.buyPrice}</td>
	</tr>
<%------------------------------------------------------------------------- --%> 
      <tr>
         <td colspan="2" align="center">입찰내역</td>
         <td rowspan="2" colspan=2  align="center">
         <input type="button" id="adminUpdat" value="수정">
         </td>
         <td rowspan="2"  align="center">
         <c:choose>      
         <c:when test="${param.deleteConfirmNo==''}">      		
         </c:when>
         <c:otherwise>
           <input type="button" id="adminDel" value="삭제">
         </c:otherwise>
            </c:choose>
         </td>
      </tr>
<%-------------------------------------------------------------------------- --%>      
      <tr>
      <td colspan="2" align="center">
     <c:forEach items="${vo.bdvo}" var="bdvo"  varStatus="i">
		  <c:set var="id" value='${bdvo.sellerId}'/>
		  <c:if test="${i.count==1}">
		  
		  <c:set var="leastPerson" value="${id}"></c:set>
		  <input type="hidden" id="leasePerson" name="leastPerson" value="${leastPerson}">
		  	최저가 제시자 : ${fn:substring(id, 0,2)}<c:forEach  begin="1" end='${ fn:length(id)-2}' >*</c:forEach><br>
		  </c:if>
			 ${i.count}   ${fn:substring(id, 0,2)}<c:forEach  begin="1" end='${ fn:length(id)-2}' >*</c:forEach>  님 제시가 ${bdvo.bidPrice}원 <Br>
		</c:forEach>
      </td >
      </tr>
<%-------------------------------------------------------------------------- --%>      
      <tr>
         <td  colspan="5"  align="center">${vo.avo.boardContent}</td>
      </tr>
<%-------------------------------------------------------------------------- --%>
   </table>
